#ifndef _WREGISTRY_H
#define _WREGISTRY_H

/******************************************************************************
** @file	WRegistry.h
** @author	Marco Galvez 
** @date	Jul 25, 2010
**
** @desc	This class represents a Windows Registry. It also has a
**			HiveEnumerator with the 5 constans of the Registry 
**			
**
******************************************************************************/

#include <string>
#include <vector>
#include <iostream>
#include "WValue.h"
#include "WinObject.h"
#include "WConstants.h"
#include <log4cxx\logger.h>
#include <log4cxx\xml\domconfigurator.h>

/*
* Hive enum is an enumerator that represents the 5 hive registrys of windows 
*
*/
enum HiveEnum { 
	R_CLASSES_ROOT,
	R_CURRENT_USER, 
	R_LOCAL_MACHINE, 
	R_USERS,
	R_CURRENT_CONFIG, 
	R_DYN_DATA 
};

class WRegistry : public WinObject
{
public:
	/**
	* Constructor of WRegistryClass
	*
	* @param root, it's a HiveEnum it represents a Hive of the registry for example HKEY_CLASSES_ROOT
	* @param name, a wstring it is the name that the objet will have
	* @param subKey, a wstring that represents a subKey of the resgitry 
	*/
	WRegistry(  std::wstring name,std::wstring path);

	/**
	* Copy Constructor
	* @param registry, a WRegistry that provides the data to create a ne object
	*/
	WRegistry(const WRegistry& registry);

	/**
	* Default Constructor
	*/
	WRegistry();

	/**
	* Destructor
	*/
	~WRegistry();

	/*
	* getName the method returns the name of the registry
	* @return wstring with the name of the registry
	*/
	std::wstring 
	WRegistry::getName()
	{
		return _name;
	}

	/*
	* setName method, sets a new name to a registry, the old name will be lost
	* @param name, a wstring with the nw name
	*/
	void 
	WRegistry::setName(std::wstring name)
	{
		_name=name;
	}

	/*
	* getPath, this method returns the path to access to the registry
	* @return  wstring,  return a wstring with the path
	*/
	std::wstring 
	WRegistry::getPath()
	{
		return _path;
	}

	/*
	* setPath, this method sets the path of the registry
	* @param return a wstring with the path
	*/
	void 
	WRegistry::setPath(std::wstring path)
	{
		_path=path;
	}

	/*
	* getRegistryList returns a stl vector with the children registrys
	* @return a stl vector<WRegistry>
	*/
	std::vector<WRegistry*> 
	WRegistry::getRegistryList()
	{
		return _registryList;
	}		

	/*
	* addRegistry add a new children to the current registry
	* @param WRegistry*, is the children to add
	*/
	void 
	WRegistry::addRegistry(WRegistry *registry);

	/*
	* addValue add a new value to the current registry
	* @param WValue, is the value to add
	*/
	void 
	WRegistry::addValue(WValue value);

	/*
	* print method prints the name of the registry, its values and also its childrens
	*/
	void 
	WRegistry::print();
	
	/*
	* operator = overloaded, 
	*/
	WRegistry& operator= (const WRegistry& registry);

private:
	std::wstring _name;
	std::wstring _path;
	std::vector<WRegistry*> _registryList;
	std::vector<WValue> _valueList;
};

#endif